function updateagent(k, iter)


global u v w du dv dw a b c dt h m x y dx dy Gu Gv Gw

j = round(y(k)/h);
i = round(x(k)/h);

if i > m
    i = m;
    x(k) = m*h;
end
if i < 1
    i = 1;
    x(k) = 1;
end
if j > m
    j = m;
    y(k) = m*h;
end
if j < 1
     j = 1;
    y(k) = 1;
   
end

if iter > 0

    dx(k) = dx(k) + 0.001*Gu(i,j);
    dy(k) = dy(k) + 0.001*Gv(i,j);
end


%w(i,j) = 5;

end